/**
 * 完成服务通知
 */

//引入Q模块
let Q = require('q');

//done入口函数
let index = function(getData, postData, config, _redis, db) {
	let deferred = Q.defer();
	console.log(postData.storeId, postData.funId, postData.timestamp);
	if(postData.storeId && postData.funId && postData.timestamp) {
		deferred.resolve(['broadcast', {
			storeId: postData.storeId,
			type: 'sys',
			event: 'storeFunDone',
			data: {
				funId: postData.funId,
				timestamp: postData.timestamp,
				lastDoneFunTimestamp: postData.lastDoneFunTimestamp
			}
		}]);
	}
	else {
		deferred.reject('-0097');
	}
	return deferred.promise;	
}

//暴露接口
module.exports = {
	index: index
};

